<?php
    @header("Content-type:text/html;charset=utf-8");
    @include_once("./connect.php");
    if(!(isset($_POST["user"])&&isset($_POST["pwd"])&&isset($_POST["phone"])&&isset($_POST["email"]))){
        $obj = array();
        $obj["status"] = false;
        $obj["msg"] = "请传入完整参数";
        $json = json_encode($obj);
        exit($json);
    }
    $user = $_POST["user"];
    $pwd = $_POST["pwd"];
    $phone = $_POST["phone"];
    $email = $_POST["email"];

    $sql = "insert into `userinfo`(user,pwd,phone,email) values ('$user','$pwd','$phone','$email')";

    $result = mysqli_query($conn,$sql);

    $obj = array();

    if($result){
        $rows = mysqli_affected_rows($conn);

        if($rows>0){
            $obj["status"] = true;
            $obj["msg"] = "新增成功";
        }
    }else{
        $obj["status"] = false;
        $obj["msg"] = "sql语句有误";
        $obj["sql"] = $sql;
    }
    echo json_encode($obj);



?>